//
//  customCollectionViewCell.m
//  YuErmuYing
//
//  Created by Tiancheng on 16/9/8.
//  Copyright © 2016年 Tiancheng. All rights reserved.
//

#import "customCollectionViewCell.h"
#import "Macros.h"

@implementation customCollectionViewCell

-(id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self)
    {
        float width=0.443*screenWidth/2;
        self.nameLabel=[[UILabel alloc]initWithFrame:CGRectMake(10, 10,width, 21)];
//        self.nameLabel.backgroundColor=[UIColor orangeColor];
        self.nameLabel.textColor=[UIColor blackColor];
        self.nameLabel.font=[UIFont systemFontOfSize:15];
        self.nameLabel.textAlignment=NSTextAlignmentLeft;
        
        float contentLabel_y=self.nameLabel.frame.origin.y+self.nameLabel.frame.size.height+5;
        self.contentLabel=[[UILabel alloc]initWithFrame:CGRectMake(10, contentLabel_y, width, 21*3)];
        self.contentLabel.textColor=[UIColor grayColor];
        self.contentLabel.font=[UIFont systemFontOfSize:12.0];
        self.contentLabel.numberOfLines=0;
        self.contentLabel.textAlignment=NSTextAlignmentLeft;
//        self.contentLabel.backgroundColor=[UIColor orangeColor];
        float picImageView_x=self.contentLabel.frame.size.width+5;
        self.picImageView=[[UIImageView alloc]initWithFrame:CGRectMake(picImageView_x, 10, 0.448*screenWidth/2, 0.53333*screenWidth/2)];
//        self.picImageView.backgroundColor=[UIColor orangeColor];
        float grayView_y=self.picImageView.frame.size.height+self.picImageView.frame.origin.y+10;
        self.grayView=[[UIView alloc]initWithFrame:CGRectMake(10, grayView_y, 0.709*screenWidth/2-0.05333*screenWidth, 3)];
        self.grayView.backgroundColor=[UIColor grayColor];
        self.redView=[[UIView alloc]initWithFrame:CGRectMake(10,grayView_y, 0.709*screenWidth/2-0.05333*screenWidth, 3)];
        self.redView.backgroundColor=pinkColor;
        float involeLabel_y=self.redView.frame.size.height+self.redView.frame.origin.y;
        self.involeLabel=[[UILabel alloc]initWithFrame:CGRectMake(10, involeLabel_y, 30, 21)];
        self.involeLabel.textColor=pinkColor;
        self.involeLabel.font=[UIFont systemFontOfSize:15.0];
        self.involeLabel.textAlignment=NSTextAlignmentLeft;
//        self.involeLabel.backgroundColor=[UIColor orangeColor];
        self.sumLabel=[[UILabel alloc]initWithFrame:CGRectMake(0.709*screenWidth/2-0.05333*screenWidth*2, involeLabel_y, 50, 21)];
        self.sumLabel.textColor=pinkColor;
        self.sumLabel.textAlignment=NSTextAlignmentLeft;
        self.sumLabel.font=[UIFont systemFontOfSize:15.0];
//        self.sumLabel.backgroundColor=[UIColor orangeColor];
        float joinBtn_x=self.redView.frame.size.width+self.redView.frame.origin.x;
        self.joinBtn=[[UIButton alloc]initWithFrame:CGRectMake(joinBtn_x+3, grayView_y, 0.12*screenWidth, 0.0533333*screenWidth)];
        [self.joinBtn setTitle:@"参与" forState:UIControlStateNormal];
        [self.joinBtn setTitleColor:pinkColor forState:UIControlStateNormal];
        //设置按钮的圆角半径不会被遮挡
        [self.joinBtn.layer setMasksToBounds:YES];
        //        [commitBtn.layer setCornerRadius:10];
        //设置边界的宽度
        [self.joinBtn.layer setBorderWidth:1];
        [self.joinBtn.layer setBorderColor:pinkColor.CGColor];
        
        [self.contentView addSubview:self.nameLabel];
        [self.contentView addSubview:self.contentLabel];
        [self.contentView addSubview:self.picImageView];
        [self.contentView addSubview:self.grayView];
        [self.contentView addSubview:self.redView];
        [self.contentView addSubview:self.involeLabel];
        [self.contentView addSubview:self.sumLabel];
        [self.contentView addSubview:self.joinBtn];
    }
    return self;
}
- (void)awakeFromNib {
    // Initialization code
}

@end
